<?php 

class Players
{
	static $playerState = array(
		'Watching',
		'PlaceArmy',
		'Attack',
		'Fortify',
		);

	function __construct($data = array())
	{
		$this->name 		= $data['name'];
		$this->isYou		= $data['isYou'];
		$this->numberOfArmies 	= $data['numberOfArmies'] ? $data['numberOfArmies'] : 0;
		$this->numberOfCards = $data['numberOfCards'] ? $data['numberOfCards'] : 0;
		$this->numberOfLands = $data['numberOfLands'] ? $data['numberOfLands'] : 0;
		$this->playerState 	= $data['playerState'] ? $data['playerState'] : Players::$playerState[0];
	}

	// factory function
	function getPlayers()
	{
		/*
		*
		* should be changed to match backend settings
		*
		*/

		$players = array();

		for ($i = 0; $i < 4; $i++)
		{
			$arr = array(name => "player$i");
			$arr['isYou'] = $i == 0 ? 1 : 0;
			$players[] = new Players($arr);
		}

		return $players;

	}
}
